how to find factors of a number in java